// 系统信息
const systemInfo = uni.getSystemInfoSync()
// 胶囊按钮
let menuButtonHeight = null

// 状态栏高度
export const getStatusBarHeight = () => systemInfo.statusBarHeight || 0

// 胶囊高度(包括距离状态栏的高度)
export const getMenuButtonHeight = () => {
	// #ifdef MP
	if (menuButtonHeight) return menuButtonHeight
	if (uni.getMenuButtonBoundingClientRect) {
		const { top, height } = uni.getMenuButtonBoundingClientRect()
		// 计算高度
		menuButtonHeight = (top - getStatusBarHeight()) * 2 + height
		return menuButtonHeight
	}
	// #endif
	return 40
}
// 胶囊顶部间距
export const getMenuButtonTop = () => {
	if (uni.getMenuButtonBoundingClientRect) {
		const { top } = uni.getMenuButtonBoundingClientRect()
		return top - getStatusBarHeight()
	}
	return 0
}

// navbar总高度
export const getNavBarHeight = () => getStatusBarHeight() + getTitleBarHeight()